package wsp.dailymarket.shopping;

import java.text.NumberFormat;
import wsp.dailymarket.deals.DealBean;

/**
 *
 * @author Matt
 */
public class CartItem {

	private DealBean cartDeal;
	private long quantity;

	public long getQuantity() {
		return this.quantity;
	}

	public void setQuantity(long newValue) {
		this.quantity = newValue;
	}

	public void incrementQty() {
		this.quantity++;
	}

	public void decrementQty() {
		this.quantity--;
	}

	public CartItem(DealBean theDeal) {
		this.cartDeal = theDeal;
		this.quantity = 1;
	}

	public CartItem() {
		this.cartDeal = null;
		this.quantity = 0;
	}

	public DealBean getDeal() {
		return this.cartDeal;
	}

	public double getTotalLineItemPrice() {
		return this.cartDeal.getPrice() * this.quantity;
	}

	public String getTotalLineItemPriceDisplay() {
		return NumberFormat.getCurrencyInstance().format(this.getTotalLineItemPrice());
	}

}
